package com.ibeetl.codestory.core.match;

import com.ibeetl.codestory.core.ast.Ast;
import com.ibeetl.codestory.core.ast.TypedAst;
import com.ibeetl.codestory.core.type.Type;

public class ExactMethodMatcher implements Matcher {
	String baseClass;
	String methodName;
	public ExactMethodMatcher(String baseClass,String methodName){
		this.baseClass = baseClass;
		this.methodName = methodName;
	}

	@Override
	public boolean match(Ast ast) {
		TypedAst typedAst = (TypedAst)ast;
		Type type = typedAst.getType();
		return  type.canCast(baseClass)&&typedAst.getToken().equals(methodName);

	}
}
